<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>权限管理</title>
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>ui/css/right.css">
</head>
<script type="text/javascript">
	function show(divId) {
		$("#" + divId).slideToggle();
	}
	function deleteNode(id,nodeCode){
	if(!confirm('确定删除该权限？')) return false;
	 $.post("${basePath}sysnode/delete.html",{"id":id,"nodeCode":nodeCode},function (data){
	   if(data && data=="Y"){
	       document.location.href="<%=basePath%>sysnode/list.html?porCode=${porCode}";
	   }else{
	     alert("此权限正在使用，不能删除！");
	   }
	 });
	}
</script>
<div id="all">
	<div id="main">
		<div class="pageColumn">
			<div class="add_div">
				<%@ include file="/common/nav.jsp"%>
					<span style="float: right;padding-right: 10px"><button
						onclick="javascript:window.location.href='${basePath}sysnode/edit.html?porCode=${porCode}'"
						class="add_btn">新 增</button> </span>
			</div>
			<div style="float: right;width: 100%">
				<table>
					<thead>
						<tr>
							<th>父权限</th>
							<th>权限名称</th>
							<th>是否公开</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${list }" var="p" >
							<c:if test="${p.parentsNodeId=='0' }">
								<tr>
									<td> <img alt="展开" src="${basePath}image/frame/communication.gif" onclick="show('div_${p.id}')"></td>
									<td>${p.nodeName }</td>
									<td><c:if test="${p.isOpen==1 }">是</c:if> <c:if
											test="${p.isOpen==0 }">否</c:if></td>
									<td>
									<a href="${basePath}sysnode/edit.html?parentsNodeId=${p.nodeCode}&porCode=${porCode}" title="新增子权限"><img
																width="16" height="16"
																src="${basePath}image/frame/add.gif">&#12288;</a>
									<a href="${basePath}sysnode/edit.html?id=${p.id}&porCode=${porCode}" title="编辑"><img
											width="16" height="16"
											src="${basePath}image/frame/edit2.png"></a>&#12288; <a
										href="javascript:void(0)"
										onclick="deleteNode(${p.id},'${p.nodeCode }')" title="删除"><img
											width="16" height="16"
											src="${basePath}image/frame//del.png"></a></td>
								</tr>
								<tr id="div_${p.id}" style="display: none">
									<td colspan="4" style="text-align: center;padding-left: 10%;padding-bottom: 10px">
									<div style="float: center;width: 100%;">
										<table style="width: 90%;text-align: center;">
										<colgroup>
										 <col width="20%">
										 <col width="10%">
										 <col width="40%">
										 <col width="20%">
										</colgroup>
											<thead>
												<tr>
													<th>权限名称</th>
													<th>是否公开</th>
													<th>url</th>
													<th>操作</th>
												</tr>
											</thead>
											<c:forEach items="${list }" var="c" varStatus="j">
												<c:if test="${c.parentsNodeId==p.nodeCode }">
													<tr>
														<td>${c.nodeName }</td>
														<td><c:if test="${c.isOpen==1 }">是</c:if> <c:if
																test="${c.isOpen==0 }">否</c:if></td>
														<td>${c.url }</td>
														<td>
														
														<a
															href="${basePath}sysnode/edit.html?id=${c.id}&porCode=${porCode}"><img
																width="16" height="16"
																src="${basePath}image/frame/edit2.png" title="编辑"></a>&#12288;
															<a href="javascript:void(0)"
										onclick="deleteNode(${c.id},'${c.nodeCode }')"><img title="删除"
																width="16" height="16"
																src="${basePath}image/frame//del.png"></a></td>
													</tr>
												</c:if>
											</c:forEach>
										</table>
										</div>
									</td>
								</tr>
							</c:if>

						</c:forEach>
					</tbody>
				</table>



			</div>

		</div>
	</div>
</div>
</body>
</html>
